{template nheader.html}

<script type="application/javascript">

</script>
<script>
    function uploadFile(){
        // alert('123');
        var myform = new FormData();
        myform.append('img',$('#load_img')[0].files[0]);
        // console.log(s);return false;
        $.ajax({
            url: "admin.php?c=news&m=uploadImg",
            type: "POST",
            data: myform,
            contentType: false,
            processData: false,
            success: function (data) {
                // console.log(data);
                var obj = JSON.parse(data);
                if(obj.status == 1){
                    $('input[name="upload_img"]').val(obj.img_url)
                }
            },
            error:function(data){
                console.log(data)
            }
        });
    }
</script>
<form class="form-horizontal" action="" method="post" id="myform" name="myform" style="margin-top:30px;margin-bottom: 70px;">
    <input type="hidden" name="nid" value="{$nid}"/>
    <input type="hidden" name="upload_img" value=""/>
    <div class="portlet light bordered">

        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject font-green bold uppercase">{$name}</span>
            </div>
        </div>
        <div class="portlet-body">
            <div class="portlet-body form">
                <div class="form-body">
                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('标题')}：</label>
                        <div class="col-md-9">
                            <label><input type="text" class="form-control" id="dr_title" name="data[title]" value="{$data.title}"></label>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label class="col-md-2 control-label">{fc_lang('短标题')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">

                                <label>
                                    <input type="text" class="form-control" id="dr_short_title" name="data[short_title]" value="{$data.short_title}">
                                </label>
                                <span class="help-block">{fc_lang('给它一个描述名称')}</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('图片')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                <!--{dr_field_input('img', 'File', $field['img']['setting'], $data['img'])}-->
                                <input type="file" id="load_img" name="img"onchange ="uploadFile()"/>
                                {if $data['img']}
                                 <img src="{$data['img']}">
                                {/if}
                                <span class="help-block">{fc_lang('图片标识，例如一个图标等等')}</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('类型')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                <div class="radio-list">
                                    <label class="radio-inline"><input name="data[type]" type="radio" value="1" {if $data.type == 1}checked="checked"{/if} /> {fc_lang('图书书籍')}</label>
                                    <label class="radio-inline"><input name="data[type]" type="radio" value="2" {if $data.type == 2}checked="checked"{/if} /> {fc_lang('户学头条')}</label>
                                    <label class="radio-inline"><input name="data[type]" type="radio" value="3"  {if $data.type == 3}checked="checked"{/if}  /> {fc_lang('教育头条')}</label>
                                </div>

                            </div>
                        </div>
                    </div>
                    {$myfield}
                    {if $myfile}{template $myfile}{/if}

                    <div class="form-group nav_0">
                        <label class="col-md-2 control-label">{fc_lang('热点精华')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                <div class="radio-list">
                                    <label class="radio-inline"><input name="data[hotspot]" type="radio" value="0" {if $data.hotspot == 0}checked="checked"{/if} /> {fc_lang('否')}</label>
                                    <label class="radio-inline"><input name="data[hotspot]" type="radio" value="1"  {if $data.hotspot == 1}checked="checked"{/if}/> {fc_lang('是')}</label>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
    </div>

    <div class="myfooter">
        <div class="row">
            <div class="portlet-body form">
                <div class="form-body">
                    <div class="form-actions">
                        <div class="row">
                            <div class="col-md-12 text-center">
                                <button type="submit" class="btn green"> <i class="fa fa-save"></i> {fc_lang('保存')}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

{template nfooter.html}